
logistic_recp = recipe(diagnosis~.,data = train_data) |>
  step_smotenc(diagnosis,over_ratio=0.5 ,neighbors=1,seed=123)

logistic_spec = logistic_reg() |>
  set_engine("glm") |>
  set_mode("classification")

logistic_flow = workflow() |>
  add_recipe(logistic_recp) |>
  add_model(logistic_spec)

logistic_fit = fit(logistic_flow,data = train_data)
logistic_predict = augment(logistic_fit,new_data=test_data)

logistic_auc = roc_auc(data = logistic_predict,truth = diagnosis,.pred_1,event_level="second")
logistic_acc = accuracy(data = logistic_predict,truth = diagnosis,.pred_class)
logistic_sens = sensitivity(data=logistic_predict,truth = diagnosis,.pred_class,event_level = "second")
logistic_spec = specificity(data=logistic_predict,truth = diagnosis,.pred_class,event_level = "second")
logistic_ppv = ppv(data=logistic_predict,truth = diagnosis,.pred_class,event_level = "second")
logistic_conf_mat = conf_mat(data=logistic_predict,truth = diagnosis,.pred_class)
logistic_f_meas = f_meas(data=logistic_predict,truth = diagnosis,.pred_class,event_level = 'second')

# logistic_evaluation_table <- tibble(
#   metric = c("auc", "acc","sens","spec","ppv"),
#   value = c(auc$.estimate, acc$.estimate,sens$.estimate,spec$.estimate,ppv$.estimate)
# )

# logistic_evaluation_table
